perm filename MACROS.TEX[TEX,RWF]1 blob sn#537112 filedate 1980-09-22 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00009 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	 \input arkmac.tex[tex,rwf]	% start from Arthur's macros.
C00004 00003	%   section heading macros 
C00006 00004	% Specialty macros for exercises, examples, rules, etc.
C00012 00005		% code macros peculiar to Notes.
C00014 00006	% new Sending macros.  sendnotes and sendindex, w. friends.
C00017 00007		% Alignment macros for tables.
C00021 00008	 % Shorthands for typing some symbols in text.
C00023 00009	% Arthur left thes out of his macs. They are taken from basic
C00025 ENDMK
C⊗;
 \input arkmac.tex[tex,rwf]	% start from Arthur's macros.

	\def\font{\:}		% Temporarily necessary

%   section heading macros 

\def \goodbreak{\penalty-1000}
\def \badbreak{\penalty1000}

\def \sneakhead#1{\goodbreak	% Good place to break.
		\yyskip		% Skip a little space.
		\noindent
		{\bf #1}\par	% Put in section name.
		\badbreak
		\posthdrskip
	}
\def \head#1{\sneakhead{#1}
		% Send #1 to contents?
	}

	% Body copied from Arthur's \specialbegin, with mod to incl. APPENDIX.
\def\appendix #1. #2{\par\titlemark{#2}{\sectionname}
	\par\vfill\eject
	\sectionskip
	\gdef\sectionnumber{#2}
	\gdef\sectionname{#2}
	\par\titlemark{#2}{#2}
	{\noindent \ss APPENDIX #1. #2.}
	\par\posthdrskip}

	% Old version of appendix, before RWF asked for app title in page
	% header.
%\def \appendix #1. #2{
%		\par\vfill\eject	% next page.
%		{\bf APPENDIX #1. #2}\par	% put in header.
%		\posthdrskip
%		% Send #2 to contents?
%	}

% Specialty macros for exercises, examples, rules, etc.

\def \bitem{\par\noindent\hangindent 30pt\hbox to 15pt{\ctr{$\bullet $}}}
\def \bitemindent{\par\noindent\hangindent 30pt\hbox to 30 pt{\hfill}}

	% fakfigure takes size of white space and title to put below.
\def \fakfigure#1#2{\goodbreak
		\vbox{\vskip#1pt\ctrline{\sl #2}\yskip}
		\sendnotes{BYHAND-Insert figure here. #2}
	}


\def \rulefont{\sl}
\def \normalfont{\fontsize}
\def \smallfont{\eightpoint}
\def \exercisefont{\smallfont}
\def \solutionfont{\smallfont}

\def \textflag#1{\goodbreak\yyskip\noindent{\bf #1}\par\badbreak}

\def \pnote#1{\textflag{Pascal Note: #1}}

\def \example{\textflag{Example}}
%\def \example{\penalty-1000\textflag{Example\penalty1000}}

\def \sample{\par\vfill\eject\textflag{Sample Program}}

\def \newexercise#1{\textflag{Exercise}
			{\smallfont #1}\goodbreak}

\def \exercise{\textflag{Exercise}\smallfont}
\def \endexercise{\goodbreak\normalfont}


\def \newsolution#1{\textflag{Solution}
			{\smallfont #1}\goodbreak}


\def \solution	{\par\vfill\eject\textflag{Solution}
		%\indpar maybe.  Indented paragraph?
		\smallfont
	}
\def \endsolution	{\goodbreak
		\normalfont
	}

\def \concept	{\textflag{Definition}}

\def \rule#1{\par\goodbreak\yyskip
	\ctrline{\boxit{\vbox{\hbox to 25pc{\ctr{\bf Rule of Good Programming Practice:}}
		     \vskip 2 pt
		     \hbox par 25pc{\sl #1}
		    }
		}}
	\sendindex{Rule}
	\yyskip
	}

	% code macros peculiar to Notes.

\def \displayline#1{$$\hbox to size{\hskip 40pt #1 \hfill}$$}
\def \wuncode#1{\displayline{{\tt #1}}}

\def \samecode#1{\def\|{\vrule height 9 pt depth 2 pt}
		 \def\1{\quad}
		 \def\2{\qquad}
		 \def\3{\quad\qquad}
	\par\yyskip
	{\baselineskip 0 pt\lineskip 0 pt
	   \hbox to size{\hskip 40pt
\vbox{\halign{{\tt ##\hfill}\quad\|\quad⊗{\tt ##\hfill}\quad\cr #1}}
			 \hfill}
	}
	\yyskip
}

\def \twocolcode#1{\def\|{\vrule height 9 pt depth 2 pt}
		 \def\1{\quad}
		 \def\2{\qquad}
		 \def\3{\quad\qquad}
	\par\yyskip
	{\baselineskip 11pt\lineskip 1pt
	   \hbox to size{\hskip 40pt
\vbox{\halign{{\tt ##\hfill}\quad\quad⊗{\tt ##\hfill}\quad\cr #1}}
			 \hfill}
	}
	\yyskip
}

\def \displaylines{\def \|{\vrule height 2pt}
			\vbox{\hrule
				\hbox to size{\|\hfill\|}
			  \hrule}
		    }

\def \topoutput{\par\penalty-4000\displaylines\penalty4000\startcodenoglue}

\def \botoutput{\endcodenoglue\penalty4000\displaylines\penalty-4000}


% new Sending macros.  sendnotes and sendindex, w. friends.

\def \initnotes{\open0=fixnot.tex \send0{\ctrline{\bf Fixup Notations}\yyskip}}
\def \initindex{\open1=index.tex \send1{\ctrline{\bf Index}\yyskip}}

\def \sendnotes#1{\send0{Page \count0. #1\par}}

\def \putnotes	{\specialbegin{Fixup Notations}
		\open0=temp1.tex	% Close the fixnot file
		\input fixnot.tex	% Now put text here.
	}

\def \sendindex#1{\send1{#1 -- Page \count0\par}}

\def \putindex	{\specialbegin{Index}
		\open1=temp2.tex	% Close the index file.
		\input index.tex	% Put text here.  Eventually sort first.
	}


	% Alignment macros for tables.

	% \dtable gives a centered, displayed table.  Argument looks like an
	%   argument to \halign including the blueprint.
\def \dtable#1{$$\vbox{\halign{#1}}$$}

\def \twocolleft#1{\dtable{##\hfill⊗\qquad##\hfill\cr #1}}
\def \threecolleft#1{\dtable{##\hfill⊗\qquad##\hfill⊗\qquad##\hfill\cr #1}}
\def \fourcolleft#1{\dtable{##\hfill⊗\qquad##\hfill⊗\qquad##\hfill⊗\qquad##\hfill\cr #1}}

\def \twocolalign#1{\twocolleft{#1}}

\def \threecolalign#1{\threecolleft{#1}}

\def \threecolctralign#1{\dtable{\hfill##\hfill⊗\qquad\hfill##\hfill⊗\qquad\hfill##\hfill\cr #1}}

\def \fourcolalign#1{\fourcolleft{#1}}

 % Shorthands for typing some symbols in text.

%\def \hspace{\fontclassify math{\sy\char'164}tt{\ttchar{\sy\char'164}}others{\sy\char'164}}
\def \Space{{\sy\char'164}}
\def \≡{\Space}
\chcode'036←13
% The above should allow typeing ≡ and get the explicit space character.

\def \Eone {\Escr ↓1}
\def \Etwo {\Escr ↓2}
\def \En   {\Escr ↓n}

\def \Cone {\Cscr ↓1}
\def \Ctwo {\Cscr ↓2}
\def \Cthree {\Cscr ↓3}
\def \Cn   {\Cscr ↓n}

% Arthur left thes out of his macs. They are taken from basic

\def\sin{\mathop{\char s\char i\char n}\limitswitch}
\def\cos{\mathop{\char c\char o\char s}\limitswitch}
\def\tan{\mathop{\char t\char a\char n}\limitswitch}
\def\cot{\mathop{\char c\char o\char t}\limitswitch}
\def\sec{\mathop{\char s\char e\char c}\limitswitch}
\def\csc{\mathop{\char c\char s\char c}\limitswitch}

	% Eqalign from basic.tex[1,3] 3/25/80.
\def\eqalign#1{\baselineskip15pt\lineskip3pt
  \vcenter{\halign{\hfill$\dispstyle{##}$⊗$\dispstyle{\null##}$\hfill
      \cr#1}}}

\def\twoline#1#2#3{\halign{\hbox to size{##}\cr$\quad\dispstyle
              {#1}$\hfill\cr\noalign{\penalty1000\vskip#2}
              \hfill$\dispstyle{#3}\quad$\cr}}